/** 属性组件 */

import { Form, Input,Checkbox, Select } from "antd";
import { FC } from "react";
import { questionTitle_propsType } from "./index";
const { Option } = Select;
const PropsComponent:FC<questionTitle_propsType> = (props)=>{
    const { title, level, iscenter,onchange,islock = false} = props
    const [form] = Form.useForm();
    const valueChange = ()=>{
        if(onchange){
            onchange(form.getFieldsValue())
        }
    }
    return <Form 
        layout='vertical' 
        form={form} 
        initialValues={{ title, level, iscenter }}
        onValuesChange = {valueChange}
        disabled = {islock}
        >
            <Form.Item label="标题" name="title" rules={[{ required: true, message: '需要输入标题' }]}>
                <Input placeholder="请输入" value={title} />
            </Form.Item>
            <Form.Item label="量级" name="level" >
                <Select>
                    <Option value={1}>量级1</Option>
                    <Option value={2}>量级2</Option>
                    <Option value={3}>量级3</Option>
                    <Option value={4}>量级4</Option>
                </Select>
            </Form.Item>
            <Form.Item label="是否居中" name="iscenter" valuePropName="checked">
                <Checkbox></Checkbox>
            </Form.Item>
    </Form>
}

export default PropsComponent